/**
 * 
 */
package com.wsd.service.impl;

import java.util.Date;
import java.util.List;

import com.wsd.bean.OrderList;
import com.wsd.bean.ProductOrder;
import com.wsd.dao.ProductOrderDaoInterface;
import com.wsd.service.OrderService;

/**
 * @author Administrator
 *
 */
public class OrderServiceImpl implements OrderService {
	private ProductOrderDaoInterface productOrderDAO;
	
	public ProductOrderDaoInterface getProductOrderDAO() {
		return productOrderDAO;
	}

	public void setProductOrderDAO(ProductOrderDaoInterface productOrderDAO) {
		this.productOrderDAO = productOrderDAO;
	}

	public List<ProductOrder> findAll(int start, int limit) {
		return productOrderDAO.findAll(start,limit);
	}

	public int findAllCount() {
		return productOrderDAO.findAll().size();
	}

	public List<ProductOrder> findByExample(ProductOrder order, int start, int limit) {
		return productOrderDAO.findByExample(order,start,limit);
	}

	public int findByExampleCount(ProductOrder order) {
		return productOrderDAO.findByExampleCount(order);
	}

	/* (non-Javadoc)
	 * @see com.wsd.service.OrderService#updateState(int[], boolean)
	 */
	public void updateState(int[] ids, boolean state) {
		for(int id : ids){
			productOrderDAO.updateState(id,state);
		}
	}

	/* (non-Javadoc)
	 * @see com.wsd.service.OrderService#findOrderList(int)
	 */
	public List<OrderList> findOrderList(int oid) {
		return productOrderDAO.findOrderList(oid);
	}

	/* (non-Javadoc)
	 * @see com.wsd.service.OrderService#findById(int)
	 */
	public ProductOrder findById(int oid) {
		return productOrderDAO.findById(oid);
	}

	/* (non-Javadoc)
	 * @see com.wsd.service.OrderService#search(java.lang.String, int, int)
	 */
	public List<ProductOrder> search(String key,Date startDate,Date endDate, int start, int limit) {
		return productOrderDAO.search(key,startDate,endDate,start,limit);
	}

	/* (non-Javadoc)
	 * @see com.wsd.service.OrderService#searchCoun(java.lang.String)
	 */
	public int searchCoun(String key,Date startDate,Date endDate) {
		return productOrderDAO.searchCount(key,startDate,endDate);
	}

	/* (non-Javadoc)
	 * @see com.wsd.service.OrderService#history(java.util.Date, java.util.Date, int, int)
	 */
	public List<ProductOrder> history(Date startDate, Date endDate, int start, int limit) {
		
		return productOrderDAO.history(startDate,endDate,start,limit);
	}

	/* (non-Javadoc)
	 * @see com.wsd.service.OrderService#historyCount(java.util.Date, java.util.Date)
	 */
	public int historyCount(Date startDate, Date endDate) {
		return productOrderDAO.historyCount(startDate,endDate);
	}

}
